package org.mokusakura.persistence.Util;

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public class RegularExpressionVerifyUtil {
    private static final String EMAIL_REGULAR_EXPRESSION = "^\\w+@\\w+(\\.\\w+)+$";
    private static final String PASSWORD_REGULAR_EXPRESSION = "^[\\w~!]{6,20}$";

    public static boolean isLegalEmailAddress(String email) {
        if (email == null || email.isEmpty()) {
            return false;
        }
		/*Pattern pattern = Pattern.compile(EMAIL_REGULAR_EXPRESSION);
		Matcher matcher =pattern.matcher(email);*/
        return email.matches(EMAIL_REGULAR_EXPRESSION);
    }

    public static boolean isLegalPassword(String password) {
        if (password == null || password.equals("")) {
            return false;
        }
		/*Pattern pattern = Pattern.compile(PASSWORD_REGULAR_EXPRESSION);
		Matcher matcher =pattern.matcher(password);*/
        return password.matches(PASSWORD_REGULAR_EXPRESSION);
    }

}
